/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jmenu.gui;

import java.math.BigDecimal;
import javax.swing.JLabel;

/**
 *
 * @author sevcik.roman
 */
public class ValueLabel extends JLabel
{
    public ValueLabel()
    {
        super();
        this.setValue(0.0);
        this.setFont(new java.awt.Font("Tahoma", 1, 14));
        this.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        this.setFocusable(false);
        this.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    }

    public void setValue(double value)
    {
        int decimalPlace = 2;
        BigDecimal bd = new BigDecimal( Double.toString(value) );
        bd = bd.setScale( decimalPlace, BigDecimal.ROUND_HALF_UP );
        this.setText(bd.toString());
    }

}
